
if(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
#     string(TIMESTAMP COMPILE_TIME %Y%m%d%H%M%S)

#     set(CPACK_GENERATOR "TZ" "TGZ" "TXZ" "TBZ2")
#     set(CPACK_PACKAGE_NAME ${COMPONENT_NAME})
#     set(CPACK_PACKAGE_DIRECTORY ${CMAKE_SOURCE_DIR}/output/package)
#     set(CPACK_PACKAGE_VERSION "V${COMPONENT_VERSION_MAJOR}.${COMPONENT_VERSION_MINOR}.${COMPONENT_VERSION_PATCH}.${COMPONENT_VERSION_BUILD}")
#     set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${COMPILE_TIME}.${TARGET_PLAT})

#     # set(CPACK_PACKAGE_CONTACT "xuchangle@163.com")
#     # set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "this is a Jt808server CPack")
#     # set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/INSTALL.md")

#     include(CPack)

    set(PACKAGE_COMMAND ${CMAKE_SOURCE_DIR}/tools/package.sh -n ${COMPONENT_NAME} -v ${COMPONENT_VERSION} -p ${TARGET_PLAT} -t ${CMAKE_BUILD_TYPE})
    add_custom_target(pack COMMAND ${PACKAGE_COMMAND}
                      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/output
                      COMMENT "package ${COMPONENT_NAME} to ${COMPONENT_NAME}.tar.gz")

endif()
